<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:include page="/_meta.jsp" />
<link href="/lib/easyui/themes/default/easyui.css" rel="stylesheet"
	type="text/css">
<link href="/lib/easyui/themes/icon.css" rel="stylesheet"
	type="text/css">
<title>用户管理</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
		资料管理 <span class="c-gray en">&gt;</span> 商品资料 <a
			class="btn btn-success radius r"
			style="line-height: 1.6em; margin-top: 3px"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l"> 
		    <a href="javascript:;" onclick="product_add('新增商品','/purchase/addProduct.jsp','1000','600')"
			class="btn btn-primary radius"> <i class="Hui-iconfont">&#xe600;</i>新增商品
		</a>
		</span>
	</div>
	<div class="mt-20">
		<!-- 空行 -->
		<div class="page-container "
			style="width: 1500px; height: 100%; margin: 20px auto">
			<table id="SockTable" class="easyui-datagrid" rownumber="true" pagination="true">
			</table>
			<div id="datetool" style="padding: 10px">
				<select id="search">
					<option value="proBarCode">条形码</option>
					<option value="proNumber">商品编号</option>
					<option value="proName">商品名称</option>
					<option value="proQual">规格</option>
					<option value="proUnit">单位</option>
					<option value="proAddr">产地</option>
					<option value="proClass">类别</option>
				</select> 
				搜索:<input id="searchText" style="line-height: 26px; border: 1px; solid: #ccc" /> 
				<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="doSearch()">查找</a>
			</div>
		</div>
		<jsp:include page="/_footer.jsp" />
		<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>
		<script src="/lib/easyui/jquery.easyui.min.js"></script>
		<script src="/lib/easyui/locale/easyui-lang-zh_CN.js"></script>
		<!--请在下方写此页面业务相关的脚本-->
		<script type="text/javascript">
		$(document).ready(function() {
			$('#searchText').keyup(function(event) {
				$('#SockTable').datagrid('load', {
					search : $('#search').val(),
					searchText : $('#searchText').val()
				});
			});
			
		});
			function doSearch() {
				$('#SockTable').datagrid('load', {
					search : $('#search').val(),
					searchText : $('#searchText').val()
				});
			}
			/*商品-添加*/
			function product_add(title,url,w,h){
				layer_show(title,url,w,h);
			}
			$($(function() {
				$("#SockTable")
						.datagrid(
								{
									onClickRow : function(index, field, value) {

										$(this).datagrid('beginEdit', index);
										var ed = $(this).datagrid('getEdit', {
											index : index,
											field : field
										});
										$(ed.target).focus();
									},
									title : '商品列表',
									iconCls : 'icon-edit',
									width : 1500,
									height : 350,
									singleSelect : true,
									toolbar : '#datetool',
									url : '/ProductServlet',
									columns : [ [
											{
												field : 'proBarCode',
												title : '条形码',
												width : 180,
												align : 'center'
											},
											{
												field : 'proNumber',
												title : '商品编码',
												width : 180,
												align : 'center'
											},
											{
												field : 'proName',
												title : '商品名称',
												width : 180,
												align : 'center'
											},
											{
												field : 'proQual',
												title : '商品规格',
												width : 80,
												align : 'center'
											},
											{
												field : 'proUnit',
												title : '商品单位',
												width : 80
											},
											{
												field : 'proAddr',
												title : '产地',
												width : 80,
												align : 'center',
												editor : {
													type : 'text',
													options : {
														on : 'P',
														off : ''
													}
												}
											},
											{
												field : 'proClass',
												title : '类别',
												width : 80
											},
											{
												field : 'proPurchPrice',
												title : '进价',
												width : 80
											},
											{
												field : 'proSalePrice',
												title : '售价',
												width : 80
											}] ],
									onBeforeEdit : function(index, row) {
										row.editing = true;
										updateActions(index);
									},
									onAfterEdit : function(index, row) {
										row.editing = false;
										updateActions(index);
									},
									onCancelEdit : function(index, row) {
										row.editing = false;
										updateActions(index);
									}
								});
			}));
		</script>
</body>
</html>